From: Daniel De Graaf Date: Tue, 23 Apr 2013 09:48:11 +0000 (+0200) Subject: cpupool: prevent a domain from moving itself X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~6972 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=bb812101db5117e07de1b557b355c3855850cc95;p=xen.git cpupool: prevent a domain from moving itself In the XEN_SYSCTL_CPUPOOL_OP_MOVEDOMAIN operation, the existing check for domid == 0 should be checking that a domain does not attempt to modify its own cpupool; fix this by using rcu_lock_remote_domain_by_id. Signed-off-by: Daniel De Graaf Acked-by: Juergen Gross --- diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c index 2aaa48610c..2164a9fc72 100644 --- a/xen/common/cpupool.c +++ b/xen/common/cpupool.c @@ -576,12 +576,8 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op) { struct domain *d; - ret = -EINVAL; - if ( op->domid == 0 ) - break; - ret = -ESRCH; - d = rcu_lock_domain_by_id(op->domid); - if ( d == NULL ) + ret = rcu_lock_remote_domain_by_id(op->domid, &d); + if ( ret ) break; if ( d->cpupool == NULL ) {